import addBoundary from "./addBoundary";
import addBuildings from "./addBuidings";
import addLayers from "./addLayers";
import addNavigatePath from "./addNavigatePath";
import addNavigations from "./addNavigations";
import servedata from "./datacache";

const useServeData = async (emberbox: any, store: any) => {
  const { data, navdata }: any = await servedata();
  console.log("data", data);
  const { buildings, polygon, boundary } = data;
  addBoundary(emberbox, boundary, store);
  addBuildings(emberbox, {
    type: "FeatureCollection",
    features: buildings.data,
  });
  addLayers(emberbox, polygon, store);

  addNavigations(emberbox, navdata, store);

  addNavigatePath(emberbox);
};

export default useServeData;
